Feature: 咨询列表
  作为一个律团用户
  我可以罗列咨询
  这样我可以参考别人已经问过的问题

# 不成功
Background:
Given http "accept" header is "application/json"
    And I make a "post" request to "login" with:
        | username    | password   |
        | 13702325511 | 123456   |
  And http "authorization" header exists

Scenario: 如果提交的法律类别cat_id不是数字，系统会报错
  Given I am on "/question/list_questions?cat_id=ss"
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "cat_id需要是数字" for field "cat_id"

Scenario: 如果提交的法律类别cat_id小于1，系统会报错
  Given I am on "/question/list_questions?cat_id=0.1"
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "cat_id不能少于1" for field "cat_id"

Scenario: 如果提交的页码page不是数字，系统会报错
  Given I am on "/question/list_questions?page=ss"
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "page需要是数字" for field "page"

Scenario: 如果提交的记录数rows_per_page不是数字，系统会报错
  Given I am on "/question/list_questions?rows_per_page=sss"
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "rows_per_page需要是数字" for field "rows_per_page"

Scenario: 如果提交的城市city_id不是数字，系统会报错
  Given I am on "/question/list_questions?city_id=ssss"
  And the response is in "json" format
  Then the response status code should be 400
  And I got error message "city_id需要是数字" for field "city_id"

# 成功

Scenario: 可根据法律类别来过滤咨询列表
  Given I am on "/question/list_questions?cat_id=1"
    And the response is in "json" format
    Then the response status code should be 200
    And I get message "1" for field "post_category"

Scenario: 可以按照城市id的过滤咨询咨询
  Given I am on "/question/list_questions?city_id=440100"
    And the response is in "json" format
    Then the response status code should be 200
    And I get message "440100" for field "city_id"

Scenario: 可以根据咨询的发布时间来过滤咨询列表(create_at)（要完善）
  Given I am on "/question/list_questions?published=1day"
    And the response is in "json" format
    Then the response status code should be 200
    And I got message "published=1day" for field "query"
  
Scenario: 咨询列表的默认排序方式是创建时间的倒序排列(create_at)
  Given I am on "/question/list_questions"
  And the response is in "json" format
  Then the response status code should be 200
  And the records are ordered by "created_at" in "DESC"

Scenario: 咨询列表可以按照回复数最多倒序排列
  Given I am on "/question/list_questions?order_by=most_replies"
    And the response is in "json" format
    Then the response status code should be 200
    And the records are ordered by "most_replies" in "DESC"

Scenario: 咨询列表可以按照创建时间的顺序排列 
  Given I am on "/question/list_questions?order=chronological"
  And the response is in "json" format
  Then the response status code should be 200
  And the records are order by "created_at" in "ASC"

Scenario: 可以指定返回的记录的数量
  Given I am on "/question/list_quetions?rows_per_page=4"
  And the response is in "json" format
  Then the response status code should be 200
  And there are "4" records

Scenario: 可以指定返回第几页的记录
  Given I am on "/question/list_questions?rows_per_page=10"
  And I save no "8" lawyer in record
  And I am on "/question/list_questions?rows_per_page=5&page=2"
  And the no "3" lawyer matches the record
  Then the response status code should be 200
  